package com.wanjia.bpsapi.controller;

import com.wanjia.bpsapi.pojo.model.JsonResult;
import com.wanjia.bpsapi.service.IMapService;
import com.wanjia.bpsapi.util.JsonResultUtil;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/map")
@Tag(name = "地图服务控制器")
public class MapController {

    @Setter(onMethod_ = @Autowired)
    private IMapService service;

    @GetMapping("/distance")
    @Operation(summary = "计算最短距离接口")
    public JsonResult<Double> distance(String origin, String destination) {
        return JsonResultUtil.success(service.distance(origin, destination));
    }
}
